package com.snopy.lambda;

import java.util.function.Predicate;

/**
 * @author snopy
 * @version 1.0.0
 * @classname Demo
 * @description
 * anonymous
 * syntax
 *
 * unwieldy
 * unclear
 * concise
 * cumbersome
 * compactly
 * ideal
 * frequency of occurrence
 * @email 77912204@qq.com
 * @date 2022/07/22 3:03
 */
public class Demo {
    interface Check{
        boolean test(Student stu);
    }
    public static void printStu(Student stu, Check tester){
        if (tester.test(stu)){
            System.out.println(stu.getName());
        }
    }
    public static void main(String[] args) {
        Student stu = Student.createStu();
        printStu(stu, stu1 -> stu1.name.length()>2);
    }

    static class Student{
        private String name;
        private int age;
        public Student(String name, int age) {
            this.name = name;
            this.age = age;
        }
        public static Student createStu(){
            return new Student("snopy",18);
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getAge() {
            return age;
        }

        public void setAge(int age) {
            this.age = age;
        }
    }
}
